/*
 * iShopPlace Project.
 */
package ishopplace.model.businessobject;

/**
 * CartItem business object.
 * 
 * @author <a href="mailto:derek@derekshen.com">Derek Y. Shen</a>
 */
public class CartItem {
	private Item item;
	private int quantity;
	private boolean inStock;

	public CartItem() {
	}
	
	public boolean isInStock() { 
		return inStock; 
	}
	
	public void setInStock(boolean newInStock) { 
		this.inStock = newInStock; 
	}

	public Item getItem() { 
		return item; 
	}
	
	public void setItem(Item newItem) {
	  this.item = newItem;
	}

	public int getQuantity() { 
		return quantity; 
	}
	
	public void setQuantity(int newQuantity) {
	  this.quantity = newQuantity;
	}

	public double getTotalPrice() {
		if (item != null) {
			return item.getUnitCost() * quantity;
		}
		  else {
			  return 0;
		}
	}
}
